#ifndef __X86_PM_FLAGS_H__
#define __X86_PM_FLAGS_H__


#define GDT_DATA_R       0x00   // data, read only
#define GDT_DATA_RA      0x01  // data, read only, accessed
#define GDT_DATA_RW      0x02  // data, read/write
#define GDT_DATA_RWA     0x03  // data, read/write, accessed
#define GDT_DATA_RE      0x04  // data, read only, expand-down
#define GDT_DATA_REA     0x05  // data, read only, expand-down, accessed
#define GDT_DATA_RWE     0x06  // data, read/write, expand-down
#define GDT_DATA_RWEA    0x07  // data, read/write, expand-down, accessed

#define GDT_CODE_E       0x08     // code, exec only
#define GDT_CODE_EA      0x09    // code, exec only, accessed
#define GDT_CODE_ER      0x0A    // code, exec/read
#define GDT_CODE_ERA     0x0B   // code, exec/read, accessed
#define GDT_CODE_EC      0x0C    // code, exec/conf,
#define GDT_CODE_ECA     0x0D   // code, exec/conf, accessed
#define GDT_CODE_ERC     0x0E   // code, exec/read/conf,
#define GDT_CODE_ERCA    0x0F  // code, exec/read/conf, accessed

#define  GDT_SYSTEM_SEG  0x10  // is system segment

#define  GDT_DPL_0       0x00
#define  GDT_DPL_1       0x20
#define  GDT_DPL_2       0x40
#define  GDT_DPL_3       0x50

#define  GDT_PRESENT     0x80   /* whether segment is in memory or not */

#define  GDT_GRAN 0x8000
/*
  For Exectue segment
  For Stack Segment
  For Expand-down data segment
 */
#define  GDT_DB     0x4000
#define  GDT_64CODESEG   0x2000
#define  GDT_AVL         0x1000

#define BOOTGDT_CS      (GDT_GRAN | GDT_DB | GDT_DPL_0 | GDT_SYSTEM_SEG | GDT_PRESENT | GDT_CODE_ERA)

#define BOOTGDT_DS      (GDT_GRAN | GDT_DB | GDT_DPL_0 | GDT_SYSTEM_SEG | GDT_PRESENT | GDT_CODE_RWA)

#define BOOTGDT_TSS     (GDT_PRESENT | GDT_CODE_E)

#endif  // __X86_PM_FLAGS_H__
